<template>
	<view class="hospitalInfo-wrap">
		<view class="index-bg"></view>

		<view class="hospitalInfo-main"><u-hospital-item :data="hospitaInfo" :distanceShow="false"></u-hospital-item></view>

		<view class="hospitalInfo-info">
			<u-title value="医院简介"></u-title>
			<view class="hospitalInfo-info-word">
				{{hospitaInfo.intro}}
			</view>
		</view>

		<view class="hospitalInfo-specialist" v-if="doctorList.length>0">
			<u-title value="院内专家推荐"></u-title>
			<view class="findDoctor-doctor-scroll ">
				<u-doctor-item
					v-for="(item, index) in doctorList"
					:key="index"
					:data="item"
					@click="gotoRouter('/pages-hospital/doctorInfo/doctorInfo?id=' + item.id)"
				></u-doctor-item>
			</view>
		</view>
	</view>
</template>

<script>
import uTitle from '@/components/u-title/u-title.vue';
import uDoctorItem from '@/components/u-doctor-item/u-doctor-item.vue';
import uHospitalItem from '@/components/u-hospital-item/u-hospital-item.vue';
export default {
	components: {
		uTitle,
		uHospitalItem,
		uDoctorItem
	},
	data() {
		return {
			hospitalId: null,
			hospitaInfo: {},
			doctorList: []
		};
	},
	onLoad(option) {
		this.hospitalId = option.hospitalId;
		this.queryhospById();
		this.queryDoctorList()
	},
	onShow() {},
	methods: {
		//医院详情
		queryhospById() {
			this.$api
				.queryhospById({
					params: {
						id: this.hospitalId
					}
				})
				.then(res => {
					if (res.code == 200) {
						this.hospitaInfo = res.result;
					} else {
						uni.showToast({
							title: res.message,
							icon: 'none'
						});
					}
				});
		},
		
		
		
		//医生列表
		queryDoctorList() {
			this.$api
				.queryDoctorList({
					params:{
						isExpert: 1,
						pageSize: 30,
						hospId:this.hospitalId
					}
				})
				.then(res => {
					if (res.code == 200) {
						this.doctorList = res.result.records
					} else {
						uni.showToast({
							title: res.message,
							icon: 'none'
						});
					}
				});
		},
		
	}
};
</script>

<style lang="less">
@import './hospitalInfo.less';
</style>
